<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组方法_reverse()</title>
</head>
<body>
    
</body>
</html>

<script>
// reverse() 方法用于颠倒排列数组元素，返回改变后的数组。注意，该方法将改变原数组

var arr1 = [1,2,3,4,5];
console.log(arr1);
console.log(arr1.reverse());
console.log(arr1);

var arr2 = 'HelloWorld';
console.log(arr2);
var arr3 = arr2.split("");
console.log(arr3);
var arr4 = arr3.reverse();
console.log(arr4)
var arr5 = arr4.join("");
console.log(arr5);
</script>